<h1>Search result for "<%= @s[:search] rescue nil%>".

<% if  @results.nil? || @results.total < 1 %>
No Asset Found</h1>
<% else %>

  <!-- faceted browsing.
  <% #@results.facets["facet_fields"]["colo_id_facet"].each { |key, value| %>
      <%#= Colo.find(key).name %>(<%#= value%>)
  <%# } %>
  -->
  Found <%= @results.records.length %> assets.</h1>
  
  <table>
    <tr>
      <th>ID</th>
      <th>Name</th>
      <th>Colo</th>
      <th>Type</th>
      <th>QR</th>
  
    </tr>
  
  <% @results.records.each do |a| %>

    <% if ! a.nil?%>
      <% if a.respond_to?('asset') %>
        <% a = a.asset%>
        
      <% end %>
      <tr>
        <td><%= a.id rescue nil%></td>
        <td><%= link_to a.name, edit_polymorphic_path(a.resource) rescue nil%></td>

        <td><%=h a.colo.name rescue nil %></td>
        <td><%=h a.resource_type rescue nil %></td>    
        <td>
          <% #qr = RQRCode::QRCode.new(edit_polymorphic_url(a.resource)) %>
          <table class="qr-code">
          <% #qr.modules.each_index do |x| %>
            <tr>
            <% #qr.modules.each_index do |y| %>
             <% #if qr.dark?(x,y) %>
              <td class="black"/>
             <% #else %>
              <td class="white"/>
             <% #end %>
            <% #end %>
            </tr>
          <% #end %>
          </table>
        </td>    
      </tr>
    <% end %>
  <% end %>
  
  </table>
<% end %>
